﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.validasiemail" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Administration.UserManagement;
using SIPO.Library.DomainObject.Administration.UserManagement;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;

namespace SIPO.Web.AjaxHandler.Loaddata
{
    public class validasiemail : SIPO.Web.BaseHandler
    {
        recUserRepo recUserDal = new recUserRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);

            string email = context.Request.Params["email"];
            string password = context.Request.Params["password"];
            string username = context.Request.Params["username"];
            int jml = recUserDal.validasiEmailbyUser(email,username,Helper.CreatePasswordHash(password));

            StringBuilder sbProject = new StringBuilder();

            sbProject.Append("{");
            sbProject.AppendFormat("  {0}Sector{0}:{0}{1}{0}", "\"", jml);
            sbProject.Append("}");

            context.Response.Write(sbProject.ToString());
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}